package cn.com.support.dal;

import java.util.List;

import cn.com.commons.Paginator;

public interface BaseDAO<T extends BaseDO> {
	/**
	 * 插入数据
	 * 
	 * @param obj
	 * @return
	 * @throws DAOException
	 */
	Long insert(T obj) throws DAOException;

	/**
	 * 更新数据
	 * 
	 * @param obj
	 * @return
	 * @throws DAOException
	 */
	Integer updateById(T obj) throws DAOException;

	/**
	 * 删除数据
	 * 
	 * @param obj
	 * @return
	 * @throws DAOException
	 */
	Integer deleteById(Long id) throws DAOException;

	/**
	 * 查询所有
	 * 
	 * @param condition
	 *            查询条件
	 * @return
	 * @throws DAOException
	 */
	<C> List<T> selectList(C condition) throws DAOException;

	/**
	 * 根据ID查询
	 * 
	 * @param id
	 * @return
	 * @throws DAOException
	 */
	T selectById(Long id) throws DAOException;

	/**
	 * 分页查询
	 * 
	 * @param paginator
	 * @return
	 * @throws DAOException
	 */
	<C> Paginator<C, List<T>> selectForPage(Paginator<C, List<T>> paginator)
			throws DAOException;
}
